package org.monster.context.core.request;

import org.monster.context.core.communicator.HttpHeader;
import org.monster.context.core.parameter.HttpResponse;
import org.monster.context.core.processor.ProcessRequest;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * 请求Http
 *
 * @author Monster
 */
public class RequestHttp implements Request {

    /**
     * 日志器
     */
    private static final Logger logger = Logger.getLogger(RequestHttp.class.getName());

    /**
     * 处理
     * Http请求和响应处理
     *
     * @param request  请求
     * @param response 响应
     */
    @Override
    public void process(HttpRequest request, HttpResponse response) {
        ProcessRequest processRequest = new ProcessRequest(new HttpHeader(),
                request, response);
        try {
            processRequest.processResponse(request, response);
        } catch (ClassNotFoundException ex) {
            logger.log(Level.SEVERE, null, ex);
        }
    }

}
